package com.kevin.memo;

/**
 * 代理类
 * 可以对真实对象进行增强
 *
 * @author kevin
 * @date 2025/8/7
 */
public class Proxy implements Subject{

    private RealSubject realSubject;

    @Override
    public void request() {
        if (null == realSubject){
            realSubject = new RealSubject();
        }
        preReq();
        realSubject.request();
        postReq();
    }

    private void preReq(){
        System.out.println("preReq");
    }

    private void postReq(){
        System.out.println("postReq");
    }
}
